--[[/**
-- * 
 * 目标损失生命的 N 转化为护盾
 * [0] n 万分比
 * [1] 护盾buffId
-- */]]

---@class BuffEffect593101 : BaseBuffEffect
BuffEffect593101 = ClientFight.CreateClass("BuffEffect593101", ClientFight.BaseBuffEffect)
local t = BuffEffect593101

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    local attackTarget = buff.skill.target;
    local l = FighterAttributeManager.getFightAttr(attackTarget, FighterAttributeEnum.HP) - attackTarget.hp;
    local addHp = Utils.calcRatio(l, buff.buffBean.f_BuffEffectValue[1]);
    if (addHp <= 0) then
        return IBuffEffect.FAIL;
    end
    local buffModelId = buff.buffBean.f_BuffEffectValue[2];--护盾的buffid
    BuffManager.addBuff(fight, buff.skill, buff.source, buff.target, false, buffModelId, 1, addHp, 0, 0, 0);

    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff:"
            .. buff.modelId .. " 目标损失生命的转化为护盾值: " .. addHp .. " , 损失的生命值: " .. l);

    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()